<?php
 /* 处理上传 */
  if ($_POST)
  {
	$bus_zh_name = work_str($_POST["bus_zh_name"]);			//主营产品中文名称
	$bus_en_name = work_str($_POST["bus_en_name"]);			//主营产品英文名称
	$bus_other_name = work_str($_POST["bus_other_name"]);   //主营产品其他语言名称

	$bus_order = work_str($_POST["bus_order"]);				//主营产品顺序
    $bus_id = work_str($_POST['bus_id']);
	
	if($bus_id>'0')
	{
		$query = "UPDATE $TBL_BUSP SET bus_zh_name='$bus_zh_name',bus_en_name='$bus_en_name',bus_other_name='$bus_other_name',bus_order='$bus_order' WHERE bus_id='$bus_id'";
	}
	else
	{
		$query = "INSERT INTO $TBL_BUSP SET bus_zh_name='$bus_zh_name',bus_en_name='$bus_en_name',bus_other_name='$bus_other_name',bus_order='$bus_order'";
	}
	$res = mysql_query($query);
	if (! $res)
	{
	   MyNotice("插入数据库出错,请与管理员联系",2,"bussprd.php");
	   exit(0);
	}
	MyNotice("数据录入成功",2,"bussprd.php");
	exit(0);
  }
  $tpl -> set_file(array("page" => "add_bussprd.htm"));
  //当为修改时
  if($bus_id=(int)$_GET['id'])
  {
	  $query = "SELECT * FROM $TBL_BUSP WHERE bus_id='$bus_id'";
	  $result = mysql_query( $query) or die(mysql_error());
	  $array = mysql_fetch_array( $result);
	  $tpl->set_var($array);
  }
  $frm_name=($unt_id>'0')?"修改单位类型":"添加单位类型";
  $tpl -> set_var( "frm_name",$frm_name);
  $tpl -> parse("Output","page");
  $tpl -> p("Output");
  exit(0);
?>